package com.example.myui.activity;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;

import com.example.myui.R;
import com.zyyoona7.lib.EasyPopup;
import com.zyyoona7.lib.HorizontalGravity;
import com.zyyoona7.lib.VerticalGravity;


import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class DrapMenuActivity1 extends AppCompatActivity {

    @BindView(R.id.rl_tuijian)
    RelativeLayout tuijian;
    @BindView(R.id.rl_gongsi)
    RelativeLayout gongsi;
    @BindView(R.id.rl_diqu)
    RelativeLayout diqu;
    @BindView(R.id.recyclerview_main_page)
    RecyclerView recyclerView;
    private String TAG = DrapMenuActivity1.class.getSimpleName();
    private EasyPopup tuijianPop;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_drap_menu1);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.rl_diqu)
    public void showDiqu(View view) {
        Log.i(TAG, "showCom: ");
        tuijianPop = new EasyPopup(this)
                .setContentView(R.layout.layout_tuijian)
                .setFocusAndOutsideEnable(true)
                .setBackgroundDimEnable(true)
                .setDimValue(0.4f)
//                .setHorizontalGravity(HorizontalGravity.CENTER)
                .setDimView(recyclerView)
                .setDimColor(Color.GRAY)
                .setWidth(getWindow().getWindowManager().getDefaultDisplay().getWidth())
                .createPopup();

        tuijianPop.showAtAnchorView(view, VerticalGravity.BELOW, HorizontalGravity.CENTER);
    }

    @OnClick(R.id.rl_gongsi)
    public void showGongsi(View view) {
        Log.i(TAG, "showCom: ");
        tuijianPop = new EasyPopup(this)
                .setContentView(R.layout.layout_tuijian)
                .setFocusAndOutsideEnable(true)
                .setBackgroundDimEnable(true)
                .setDimValue(0.4f)
//                .setHorizontalGravity(HorizontalGravity.CENTER)
                .setDimView(recyclerView)
                .setDimColor(Color.GRAY)
                .setWidth(getWindow().getWindowManager().getDefaultDisplay().getWidth())
                .createPopup();

        tuijianPop.showAtAnchorView(view, VerticalGravity.BELOW, HorizontalGravity.CENTER);
    }

    @OnClick(R.id.rl_tuijian)
    public void showCom(View view) {
        Log.i(TAG, "showCom: ");
        tuijianPop = new EasyPopup(this)
                .setContentView(R.layout.layout_tuijian)
                .setFocusAndOutsideEnable(true)
                .setBackgroundDimEnable(true)
                .setDimValue(0.4f)
//                .setHorizontalGravity(HorizontalGravity.CENTER)
                .setDimView(recyclerView)
                .setDimColor(Color.GRAY)
                .setWidth(getWindow().getWindowManager().getDefaultDisplay().getWidth())
                .createPopup();

        tuijianPop.showAtAnchorView(view, VerticalGravity.BELOW, HorizontalGravity.CENTER);
    }

}
